<template>

  <div class="note-list-container">
      <div class="note-list-header">
      <span>笔记列表</span>
    </div>
    <div class="note-list-content">
      <div class="note-list-item" v-for="note in noteList" :key="note.noteId">
        <div class="note-list-item-title">
          <img src="../../assets/img/note-icon.png" alt="" style="width: 30px;height: 30px">
          <span>{{note.title || '暂无标题'}}</span>
        </div>
        <div class="note-list-item-content">
          <span>{{stripHtmlTags(note.content)}}</span>
        </div>
        <div class="note-list-item-time">
          <span>{{formatDate(note.createdTime)}}</span>
        </div>
      </div>
    </div> </div>

</template>
<script >
import {formatDate} from "view-design/src/components/date-picker/util";

export default {
  name: 'NoteList',
  search: this.$route?.query?.search || "",
  data(){
    return {
      noteList: []
    }
  },
  methods:{
    formatDate,
    getDimQuery(){
      //调用接口查询数据
      this.$request.get('/note/getDimQuery', {search: this.search}).then(res => {
        if(res.data.code === 200){
          this.noteList = res.data.data;
        }else{
          this.$messageHelper.messageWarning(res.data.msg);
        }
      })
    },
  }
}

</script>
<style lang="less">
.note-list-container{
  padding: 20px 30px;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: flex-start;
  flex-direction: column;
  .note-list-header{
    height: 50px;
    font-weight: 600;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    border-bottom: 1px solid #ebeef5;
    span{
      font-size: 20px;
    }
  }
  .note-list-content{
    flex: 1;
    overflow: auto;
    .note-list-item{
      height: 200px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      justify-content: center;
      align-items: flex-start;

      border-bottom: 1px solid #ebeef5;
      .note-list-item-title{
        display: flex;
        align-items: center;
        img{
          margin-right: 10px;
        }
      }
      .note-list-item-content{
        max-height: 120px;
        padding: 10px;
      }
      .note-list-item-time{
        display: flex;
        justify-content: flex-end;
        padding: 10px;
      }
    }
  }
}
</style>
